package com.luyuan.crm.sale.model;

public enum OrderStatus {

    CREATED(1, "等待审核"), VERIFIED(2, "通过审核"), DELIVERED(3, "商品出库"), RECEIVED(4, "已经收货"), CANCELLED(5, "订单取消"), REJECTED(
            6, "客户退货"), UPDATING(7, "退回修改");

    private String name;

    private int index;

    private OrderStatus(int index, String name) {
        this.name = name;
        this.index = index;
    }

    public int value() {
        return this.index;
    }

    public static OrderStatus valueOf(int index) {
        OrderStatus orderStatusType = null;
        switch (index) {
        case 1:
            orderStatusType = OrderStatus.CREATED;
            break;
        case 2:
            orderStatusType = OrderStatus.VERIFIED;
            break;
        case 3:
            orderStatusType = OrderStatus.DELIVERED;
            break;
        case 4:
            orderStatusType = OrderStatus.RECEIVED;
            break;
        case 5:
            orderStatusType = OrderStatus.CANCELLED;
            break;
        case 6:
            orderStatusType = OrderStatus.REJECTED;
            break;
        case 7:
            orderStatusType = OrderStatus.UPDATING;
            break;
        default:
            orderStatusType = null;
            break;
        }
        return orderStatusType;
    }

    public String getName() {
        return this.name;
    }

}
